<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<script>
Array.prototype.delrepeat=function(){
		if(this instanceof Array==false){
			return;	
		};	
		var newarr=[];
		for(var i=0;i<this.length;i++){
			if(this[i] instanceof Array){
				newarr.push(delrepeat(this[i]))	
			}else{
				var flag=true;
				
				for(var j=i+1;j<this.length;j++){
					if(this[i]==this[j]){
						flag=false;
						break;	
					};	
				};	
				if(flag){
					newarr.push(this[i])	
				}
			}
		};
		return newarr;
	
};
//var arr=[];
//function Array(){
//		
//}
//var arr=new Array();

/*************--------------------------------************/

//var arr=[1,1,2,2,[3,3]];			//--->出错
var arr=[1,1,2,2];
alert(arr.delrepeat())


</script>
</body>
</html>
